﻿/*堆叠条形图*/
function ColumnStackedChart(colSCharto) {
    this.colSChartDom = colSCharto.dom;
    this.quotatitle = colSCharto.title ? colSCharto.title : " ";
    this.quotatitleD = colSCharto.quotatitleD ? colSCharto.quotatitleD : "";
    this.quotatitleDClass = colSCharto.quotatitleDClass ? colSCharto.quotatitleDClass : "";
    this.xData = colSCharto.xData;
    this.yData = colSCharto.yData;
    this.unit = colSCharto.unit ? colSCharto.unit: "件";
    this.height=colSCharto.height?colSCharto.height:"";
    var self = this;
    var isstringEmpty = self.quotatitleDClass == "" ? false : true;
    return new Highcharts.Chart({
        chart: {
            renderTo: self.colSChartDom,
            type: 'bar',
            showAxes: false,
            height:self.height
        },
        title:"",
        xAxis: {
            categories: self.xData,
            labels: {
                style: {
                    fontFamily: 'Arial Normal,Arial',
                    fontWeight:400,
                    fontSize: '14px',
                    textAlign:'left'
                },
                text: "<div class='" + self.quotatitleDClass + "' alt='" + self.quotatitleD + "' style='display: block;' onmouseover='if(" + isstringEmpty + "){showF(this);}' onmouseout='if(" + isstringEmpty + ")hideF();' >" + self.quotatitle + "</div>",
            }
        },
        yAxis: {
            gridLineWidth: 0,
            lineWidth: 1,
            title:'',
            labels: {
                formatter: function () {
                    return this.value + "件";
                }
            },
            stackLabels: {
                enabled: false,
                style: {
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
            },
        },
        credits: {
            enabled: false
        },
        legend: {
            reversed:false,
        },
        colors: ['#FAD77B','#6B9FCF','#8BC267'],
        tooltip: {
            borderColor: '#cacaca',
            borderWidth: 1,
            formatter: function (i) {
                return '<b>' + this.x + '</b><br/>' +
                            this.series.name + ': ' + this.y + '件'+ '<br/>';
            }
        },
        plotOptions: {
            series:{
                stacking:'normal',
            },
            column:{
                borderWidth:0,
                pointWidth:80,
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black'
                }
            }
        },
        series: self.yData
    });
}